<template>
	<div>
		<div>当前时间：{{ m }}</div>
		<button style="margin: 50px;" @click="send">子组件传值给父组件</button>
		<button @click="send2">son1给son2传值</button>
	</div>
</template>

<script>
import EventBus from '../components/temp';

const ran = function random() {
	return Math.floor(Math.random() * 100 + 1);
};
export default  {
	props: ['message'],
	data() {
		return {
			m: this.message
		};
	},
	methods: {
		setData(data) {
			this.m = data;
		},
		send() {
			let data = '子组件给爸爸的数据' + ran();
			this.$emit('fromSon1', data);
		},
		send2() {
			EventBus.$emit('SonGetMsg', '你好！我是子组件1' + ran());
		}
	},
	ran
};

</script>

<style></style>
